#!/usr/bin/env node

//const msg = 'd2FuZ2Rpbmc6MTIzNDU2';

//const buf = Buffer.from(msg,'base64');
//const user_pwd = buf.toString('utf8');

//console.log(`user name: ${user_pwd[0]}\npassword: ${user_pwd[1]}`);




//用户名 第3位

if(process.argv.length !== 3) {
  console.error('命令行格式：cmd base64_string');
  process.exit(1);
}
//取用户名
const buf = Buffer.from(process.argv[2], 'base64');
const info = buf.toString('utf8').split(':');

console.log(info);
if(info.length !== 2) {
  console.error('信息有误！');
  process.exit(2);
}

console.log('user name: %s\npassword: %s', info[0], info[1]);

console.log('hello','world');
